

#ifndef _ASYNC_SERIAL_H_
#define _ASYNC_SERIAL_H_
#include <time.h>
#include <stdio.h>
#include <string>
#include "Common.h"
#include "communication/AsyncComm.h"
#define      BUFFER_LENGTH 1024
using namespace std;

class AsyncSerial:public AsyncComm
{

public:
	static void InitNetwork();
	// Constructor. If fd = 0, it will be assigned 
	AsyncSerial();

	//virtual bool InitFD(int fd, Session* pSession);
	// Destructor.
	virtual ~AsyncSerial();

	// Open a connection to another machine.
	virtual bool Connect(const char * Address);
	
protected:
	virtual int _RawReadData(char* pBuff, uint32 nBuffLen );
	virtual int _RawWriteDate(char* pBuff, uint32 nDataLen ) ;
	virtual bool CloseFD() ;
	virtual bool _NonblockingFD() ;

private:
	string m_PortName;
	int  m_baudrate;
	char m_databits;
	char m_stopbits;
	char m_parity;
};


#endif /* CSERIAL_H_ */
